/*
 *  LinearAlgebra.h
 *  NSE_SOLVER
 *
 *  Created by Patrick Zulian on 1/14/11.
 *  Copyright 2011 ICS - USI - Lugano. All rights reserved.
 *
 */

#ifndef NSE_SOLVER_LINEAR_ALGEBRA_H
#define NSE_SOLVER_LINEAR_ALGEBRA_H

#include "MatrixUtils.h"
#include "VectorUtils.h"

#include "Matrix.h"
#include "Vector.h"

#include "Types.h"

namespace nsesolver {

	const Matrixd Matrix2d(double m00, double m01, 
						   double m10, double m11);
	
	const Matrixd Matrix3d(double m00, double m01, double m02,
						   double m10, double m11, double m12,
						   double m20, double m21, double m22);
	
	const Matrixd Matrix4d(double m00, double m01, double m02, double m03,
						   double m10, double m11, double m12, double m13,
						   double m20, double m21, double m22, double m23, 
						   double m30, double m31, double m32, double m33);
	

	const Vector3d CreateVector3d(double x, double y, double z);
	
	inline
	const Vector3d CreateVector3d(double x, double y, double z)
	{
		double data[3] = { x, y, z };
		return Vector3d(data);
	}
	
	inline
	const Matrixd Matrix2d(double m00, double m01, 
						   double m10, double m11)
	{
		Matrixd m(2,2);
		m(0,0) = m00;
		m(0,1) = m01;
		
		m(1,0) = m10;
		m(1,1) = m11;
		
		return m;
		
	}
	
	inline
	const Matrixd Matrix3d(double m00, double m01, double m02,
						   double m10, double m11, double m12,
						   double m20, double m21, double m22)
	{
		Matrixd m(3,3);
		m(0,0) = m00;
		m(0,1) = m01;
		m(0,2) = m02;
		
		m(1,0) = m10;
		m(1,1) = m11;
		m(1,2) = m12;
		
		m(2,0) = m20;
		m(2,1) = m21;
		m(2,2) = m22;
		
		return m;
	}
	
	inline
	const Matrixd Matrix4d(double m00, double m01, double m02, double m03,
						   double m10, double m11, double m12, double m13,
						   double m20, double m21, double m22, double m23, 
						   double m30, double m31, double m32, double m33)
	{
		Matrixd m(4,4);
		m(0,0) = m00;
		m(0,1) = m01;
		m(0,2) = m02;
		m(0,3) = m03;
		
		m(1,0) = m10;
		m(1,1) = m11;
		m(1,2) = m12;
		m(1,3) = m13;
		
		m(2,0) = m20;
		m(2,1) = m21;
		m(2,2) = m22;
		m(2,3) = m23;
		
		m(3,0) = m30;
		m(3,1) = m31;
		m(3,2) = m32;
		m(3,3) = m33;

		return m;

	}

}

#endif //NSE_SOLVER_LINEAR_ALGEBRA_H
